{extend name="public:layout" /}
{block name="title"}编辑栏目{/block}
{block name="head"}
<style>
    .tab-pane {
        padding-top: 10px;
    }
</style>
{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> <a href="{:url('index')}"> 栏目列表</a></li>
                <li class="active">编辑栏目</li>
            </ol>
        </div>
        <div class="ibox-content">
            <form method="post" class="form-horizontal" id="form">
                <input type="hidden" name="cid" value="{$info['cid']}"/>
                <input type="hidden" name="mid" id="mid" value="{$info['mid']}" data-tpl="{$dataTpl}" />
                <ul class="nav nav-tabs" role="tablist">
                    <li role="presentation" class="active">
                        <a href="#base" data-toggle="tab" role="tab">基本信息</a>
                    </li>
                    <li>
                        <a href="#extend" data-toggle="tab" role="tab">自设内容</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="base">
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">上级栏目</label>
                            <div class="col-sm-4">
                                <select name="pid" class="form-control">
                                    <option value="0">顶级栏目</option>
                                    {volist name="category" id="vo"}
                                    <option value="{$vo.cid}" {$vo.selected} {$vo.disabled}>
                                        {$vo._name}
                                    </option>
                                    {/volist}
                                </select>
                            </div>
                            <label class="col-sm-2 control-label">栏目类型</label>
                            <div class="col-sm-4">
                                <label class="radio-inline i-checks">
                                    <input type="radio" name="cat_type" value="1"
                                           {eq name="info['cat_type']" value="1" }checked{/eq} data-tpl="channel"> 频道页
                                </label>
                                <label class="radio-inline i-checks">
                                    <input type="radio" name="cat_type" value="2"
                                           {eq name="info['cat_type']" value="2" }checked{/eq} data-tpl="list"> 列表页
                                </label>
                                <label class="radio-inline i-checks">
                                    <input type="radio" name="cat_type" value="3"
                                           {eq name="info['cat_type']" value="3" }checked{/eq} data-tpl="src"> 外链
                                </label>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">栏目名称</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       name="cat_name" value="{$info['cat_name']}" placeholder="请输入栏目名称"
                                       datatype="*" />
                            </div>
                            <label class="col-sm-2 control-label">跳转url</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       name="cat_redirecturl" value="{$info['cat_redirecturl']}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">栏目图片</label>
                            <div class="col-sm-4">
                                {:widget('common/Form/singleImg',['cat_image',$info['cat_image'],$uid])}
                            </div>
                            <label class="col-sm-2 control-label">模版</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" placeholder="非专业人员请务修改！"
                                       name="cat_tpl" value="{$info['cat_tpl']}" datatype="*" />
                                <p class="help-block">非专业人员请务修改！</p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">关键字</label>
                            <div class="col-sm-10">
                                <input type="text" class="form-control"
                                       name="cat_keywords" value="{$info['cat_keywords']}" />
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">描述</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="cat_description" rows="3">{$info.cat_description}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">栏目排序</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control"
                                       name="cat_order" value="{$info['cat_order']}" />
                            </div>
                            <label class="col-sm-2 control-label">是否显示</label>
                            <div class="col-sm-4">
                                <label class="radio-inline i-checks">
                                    <input type="radio" {eq name="info['cat_show']" value="0" }checked{/eq}name="cat_show"
                                    value="0"> 不显示
                                </label>
                                <label class="radio-inline i-checks">
                                    <input type="radio" {eq name="info['cat_show']" value="1" }checked{/eq}
                                    name="cat_show" value="1"> 显示
                                </label>
                            </div>
                        </div>
                    </div>
                    <div class="tab-pane" id="extend">
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容1</label>
                            <div class="col-sm-2">
                                <p class="form-control-static">
                                    {:widget('common/Form/singleImg',['extend1', $info['extend1'],$uid])}
                                </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容2</label>
                            <div class="col-sm-10">
                                {:widget('common/Form/moreTextImg',['extend2',$info['extend2'],'请输入图片标题',$uid])}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容3</label>
                            <div class="col-sm-2">
                                <p class="form-control-static">
                                    {:widget('common/Form/singleImg',['extend3',$info['extend3'],$uid])}
                                </p>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容4</label>
                            <div class="col-sm-10">
                                {:widget('common/Form/moreTextImg',['extend4',$info['extend4'],'请输入图片标题',$uid])}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容5</label>
                            <div class="col-sm-2">
                                <p class="form-control-static">
                                    {:widget('common/Form/singleImg',['extend5',$info['extend5'],$uid])}
                                </p>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容6</label>
                            <div class="col-sm-10">
                                {:widget('common/Form/moreTextImg',['extend6',$info['extend6'],'请输入图片标题',$uid])}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容7</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="extend7" rows="3" placeholder="支持html">{$info.extend7}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容8</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="extend8" rows="3" placeholder="支持html">{$info.extend7}</textarea>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label Validform_label">自设内容9</label>
                            <div class="col-sm-10">
                                <textarea class="form-control" name="extend9" rows="3" placeholder="支持html">{$info.extend7}</textarea>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="form-group">
                    <div class="col-sm-10 col-sm-offset-2">
                        <button class="btn btn-primary" type="button" id="btnSub">
                            保存内容
                        </button>
                        <a href="{:url('index')}" class="btn btn-white">取消</a>
                        <span id="validError"></span>
                    </div>
                </div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        In('icheck',function(){
            iCheck();
            $("input[name='cat_type']").on('ifChecked', function(event){
                setTpl();
            });
        })
        ajaxSubForm('#btnSub');
    })
    /**
     * 设置模版
     */
    function setTpl(){
        var tpl_1 = $('input[name="cat_type"]:checked ').data('tpl');
        var tpl_2 = $('#mid').data("tpl");
        var catTpl = tpl_1+'_'+tpl_2;
        $("input[name='cat_tpl']").val(catTpl);
    }
</script>
{/block}